<template>
    <div>
        <Navbar></Navbar>
    </div>

    <div class="app">
        <div class="step">
            <v-chart class="chart" :option="option" />  
        </div>
    </div>
</template>

<script setup>
import Navbar from '@/components/Navbar.vue';
import { use } from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";
import { PieChart } from "echarts/charts";
import {
  TitleComponent,
  TooltipComponent,
  LegendComponent
} from "echarts/components";
import VChart, { THEME_KEY } from "vue-echarts";
import { ref, provide } from "vue";

use([
  CanvasRenderer,
  PieChart,
  TitleComponent,
  TooltipComponent,
  LegendComponent
]);

provide(THEME_KEY, "light");

const option = ref({
  title: {
    text: "Step count",
    left: "center",
    top: "3%"
  },
  tooltip: {
    trigger: "item",
    formatter: "{a} <br/>{b} : {c} ({d}%)"
  },
  legend: {
    orient: "vertical",
    left: "left",
    data: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday","Saturday","Sunday"],
    top:"7%"
  },
  series: [
    {
      name: "Step count",
      type: "pie",
      radius: "55%",
      center: ["50%", "65%"],
      data: [
        { value: 335, name: "Monday" },
        { value: 310, name: "Tuesday" },
        { value: 234, name: "Wednesday" },
        { value: 135, name: "Thursday" },
        { value: 1548, name: "Friday" },
        { value: 1548, name: "Saturday" },
        { value: 1548, name: "Sunday" }
      ],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: "rgba(0, 0, 0, 0.5)"
        }
      }
    }
  ]
});
</script>

<style lang="scss" scoped>
.app {
    background-color:  #f8feff;
    margin: 0;
    padding: 0;
    height: 98vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }

  h1{
    position: relative;
    align-items: center;
  }

.step{
  position: relative;
  display: flex;
  height: 300px;
  width: 600px;
  top: -230px;
  right: -480px;
  border-radius: 16px;
  background-color: #ffffff; // 设置为白色
  border: 1px solid #9cc2e1;
  
}

.chart {
  height: 400px;
  background-color: #ffffff;
}

</style>